package org.example.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.example.entity.UserAuthentication;

import javax.persistence.*;

/**
 * 用户会话信息实体类
 */
@Entity
@Table(name = "user_session")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserSession {

    @Id
    @Column(length = 100)
    private String sessionId;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "user_id", nullable = false)
    private UserAuthentication user;

    @Column
    private java.sql.Timestamp loginTime;

    @Column
    private java.sql.Timestamp logoutTime;

    @Column(length = 45)
    private String ipAddress;

    @Column(length = 255)
    private String userAgent;

    @Column
    private String createBy;

    @Column
    private java.sql.Timestamp createTime;

    @Column
    private String updateBy;

    @Column
    private java.sql.Timestamp updateTime;
}